/*      */ package com.wgcloud.util.msg;
/*      */ 
/*      */ import com.wgcloud.common.ApplicationContextHelper;
/*      */ import com.wgcloud.config.MailConfig;
/*      */ import com.wgcloud.dto.HostWarnDiyDto;
/*      */ import com.wgcloud.entity.AppInfo;
/*      */ import com.wgcloud.entity.CpuState;
/*      */ import com.wgcloud.entity.CpuTemperatures;
/*      */ import com.wgcloud.entity.DbInfo;
/*      */ import com.wgcloud.entity.DceInfo;
/*      */ import com.wgcloud.entity.DeskState;
/*      */ import com.wgcloud.entity.DockerInfo;
/*      */ import com.wgcloud.entity.FileSafe;
/*      */ import com.wgcloud.entity.FileWarnInfo;
/*      */ import com.wgcloud.entity.HeathMonitor;
/*      */ import com.wgcloud.entity.MailSet;
/*      */ import com.wgcloud.entity.MemState;
/*      */ import com.wgcloud.entity.NetIoState;
/*      */ import com.wgcloud.entity.PortInfo;
/*      */ import com.wgcloud.entity.ShellInfo;
/*      */ import com.wgcloud.entity.SystemInfo;
/*      */ import com.wgcloud.service.LogInfoService;
/*      */ import com.wgcloud.util.DateUtil;
/*      */ import com.wgcloud.util.ExecUtil;
/*      */ import com.wgcloud.util.HostUtil;
/*      */ import com.wgcloud.util.msg.WarnPools;
/*      */ import com.wgcloud.util.staticvar.StaticKeys;
/*      */ import java.util.Date;
/*      */ import javax.mail.Authenticator;
/*      */ import org.apache.commons.lang3.StringUtils;
/*      */ import org.apache.commons.mail.DefaultAuthenticator;
/*      */ import org.apache.commons.mail.HtmlEmail;
/*      */ import org.slf4j.Logger;
/*      */ import org.slf4j.LoggerFactory;
/*      */ import org.springframework.util.AntPathMatcher;
/*      */ 
/*      */ public class WarnMailUtil
/*      */ {
/*   39 */   private static final Logger logger = LoggerFactory.getLogger(com.wgcloud.util.msg.WarnMailUtil.class);
/*      */   
/*      */   public static final String CONTENT_SUFFIX = "<p><p><p><a target='_blank' href='#'>CloudTi</a>敬上";
/*      */   
/*   43 */   private static LogInfoService logInfoService = (LogInfoService)ApplicationContextHelper.getBean(LogInfoService.class);
/*   44 */   private static MailConfig mailConfig = (MailConfig)ApplicationContextHelper.getBean(MailConfig.class);
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   private static boolean preWarnInit(String hostname, String warnMail, String warnKey) {
/*   56 */     if (!StringUtils.isEmpty(mailConfig.getBlockIps()) && mailConfig.getBlockIps().contains(hostname)) {
/*   57 */       return false;
/*      */     }
/*      */     
/*   60 */     if ("false".equals(mailConfig.getAllWarnMail()) || "false".equals(warnMail)) {
/*   61 */       return false;
/*      */     }
/*      */     
/*   64 */     if (!StringUtils.isEmpty((CharSequence)WarnPools.MEM_WARN_MAP.get(warnKey))) {
/*   65 */       return false;
/*      */     }
/*   67 */     return true;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendWarnInfo(MemState memState) {
/*   78 */     MailSet mailSet = StaticKeys.mailSet;
/*   79 */     String key = memState.getHostname() + "_mem";
/*   80 */     boolean sign = preWarnInit(memState.getHostname(), mailConfig.getMemWarnMail(), key);
/*   81 */     if (!sign) {
/*   82 */       return false;
/*      */     }
/*   84 */     Double memWarnVal = mailConfig.getMemWarnVal();
/*      */     
/*   86 */     HostWarnDiyDto hostWarnDiyDto = (HostWarnDiyDto)StaticKeys.HOST_WARN_MAP.get(memState.getHostname());
/*   87 */     if (null != hostWarnDiyDto) {
/*   88 */       if ("no".equals(hostWarnDiyDto.getMemWarnMail())) {
/*   89 */         return false;
/*      */       }
/*   91 */       if (null != hostWarnDiyDto.getMemWarnVal()) {
/*   92 */         memWarnVal = hostWarnDiyDto.getMemWarnVal();
/*      */       }
/*      */     } 
/*      */     
/*   96 */     if (memState.getUsePer() != null && memState.getUsePer().doubleValue() >= memWarnVal.doubleValue()) {
/*      */       try {
/*   98 */         String remark = HostUtil.addRemark(memState.getHostname());
/*   99 */         String title = "内存告警：" + memState.getHostname() + remark;
/*  100 */         String commContent = "主机：" + memState.getHostname() + remark + "，当前内存使用率为" + Double.valueOf(memState.getUsePer().doubleValue()) + "，超过告警值" + memWarnVal;
/*      */         
/*  102 */         if (StaticKeys.mailSet != null) {
/*  103 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  106 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  108 */         WarnPools.MEM_WARN_MAP.put(key, "1");
/*      */         
/*  110 */         logInfoService.save(title, commContent, "1");
/*  111 */       } catch (Exception e) {
/*  112 */         logger.error("发送内存告警邮件错误：", e);
/*  113 */         logInfoService.save("发送内存告警邮件错误", e.toString(), "1");
/*      */       } 
/*      */     }
/*      */     
/*  117 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendCpuWarnInfo(CpuState cpuState) {
/*  128 */     MailSet mailSet = StaticKeys.mailSet;
/*  129 */     String key = cpuState.getHostname() + "_cpu";
/*  130 */     boolean sign = preWarnInit(cpuState.getHostname(), mailConfig.getCpuWarnMail(), key);
/*  131 */     if (!sign) {
/*  132 */       return false;
/*      */     }
/*  134 */     Double cpuWarnVal = mailConfig.getCpuWarnVal();
/*      */     
/*  136 */     HostWarnDiyDto hostWarnDiyDto = (HostWarnDiyDto)StaticKeys.HOST_WARN_MAP.get(cpuState.getHostname());
/*  137 */     if (null != hostWarnDiyDto) {
/*  138 */       if ("no".equals(hostWarnDiyDto.getCpuWarnMail())) {
/*  139 */         return false;
/*      */       }
/*  141 */       if (null != hostWarnDiyDto.getCpuWarnVal()) {
/*  142 */         cpuWarnVal = hostWarnDiyDto.getCpuWarnVal();
/*      */       }
/*      */     } 
/*      */     
/*  146 */     if (cpuState.getSys() != null && cpuState.getSys().doubleValue() >= cpuWarnVal.doubleValue()) {
/*      */       try {
/*  148 */         String remark = HostUtil.addRemark(cpuState.getHostname());
/*  149 */         String title = "CPU告警：" + cpuState.getHostname() + remark;
/*  150 */         String commContent = "主机：" + cpuState.getHostname() + remark + "，当前CPU使用率为" + Double.valueOf(cpuState.getSys().doubleValue()) + "，超过告警值" + cpuWarnVal;
/*      */         
/*  152 */         if (StaticKeys.mailSet != null) {
/*  153 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  156 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  158 */         WarnPools.MEM_WARN_MAP.put(key, "1");
/*      */         
/*  160 */         logInfoService.save(title, commContent, "1");
/*  161 */       } catch (Exception e) {
/*  162 */         logger.error("发送内存告警邮件错误：", e);
/*  163 */         logInfoService.save("发送内存告警邮件错误", e.toString(), "1");
/*      */       } 
/*      */     }
/*      */     
/*  167 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendUpSpeedWarnInfo(NetIoState netIoState) {
/*  178 */     MailSet mailSet = StaticKeys.mailSet;
/*  179 */     String key = netIoState.getHostname() + "_txbyt";
/*  180 */     boolean sign = preWarnInit(netIoState.getHostname(), mailConfig.getUpSpeedMail(), key);
/*  181 */     if (!sign) {
/*  182 */       return false;
/*      */     }
/*  184 */     Double upSpeedVal = mailConfig.getUpSpeedVal();
/*      */     
/*  186 */     HostWarnDiyDto hostWarnDiyDto = (HostWarnDiyDto)StaticKeys.HOST_WARN_MAP.get(netIoState.getHostname());
/*  187 */     if (null != hostWarnDiyDto) {
/*  188 */       if ("no".equals(hostWarnDiyDto.getUpSpeedMail())) {
/*  189 */         return false;
/*      */       }
/*  191 */       if (null != hostWarnDiyDto.getUpSpeedVal()) {
/*  192 */         upSpeedVal = hostWarnDiyDto.getUpSpeedVal();
/*      */       }
/*      */     } 
/*      */     
/*  196 */     if (!StringUtils.isEmpty(netIoState.getTxbyt()) && Double.valueOf(netIoState.getTxbyt()).doubleValue() >= upSpeedVal.doubleValue()) {
/*      */       try {
/*  198 */         String remark = HostUtil.addRemark(netIoState.getHostname());
/*  199 */         String title = "上行带宽告警：" + netIoState.getHostname() + remark;
/*  200 */         String commContent = "主机：" + netIoState.getHostname() + remark + "，当前上行带宽速率为" + Double.valueOf(netIoState.getTxbyt()) + "K/s，超过告警值" + upSpeedVal + "K/s";
/*      */         
/*  202 */         if (StaticKeys.mailSet != null) {
/*  203 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  206 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  208 */         WarnPools.MEM_WARN_MAP.put(key, "1");
/*      */         
/*  210 */         logInfoService.save(title, commContent, "1");
/*  211 */       } catch (Exception e) {
/*  212 */         logger.error("发送上行带宽告警邮件错误：", e);
/*  213 */         logInfoService.save("发送上行带宽告警邮件错误", e.toString(), "1");
/*      */       } 
/*      */     }
/*  216 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendDownSpeedWarnInfo(NetIoState netIoState) {
/*  227 */     MailSet mailSet = StaticKeys.mailSet;
/*  228 */     String key = netIoState.getHostname() + "_rxbyt";
/*  229 */     boolean sign = preWarnInit(netIoState.getHostname(), mailConfig.getDownSpeedMail(), key);
/*  230 */     if (!sign) {
/*  231 */       return false;
/*      */     }
/*  233 */     Double downSpeedVal = mailConfig.getDownSpeedVal();
/*      */     
/*  235 */     HostWarnDiyDto hostWarnDiyDto = (HostWarnDiyDto)StaticKeys.HOST_WARN_MAP.get(netIoState.getHostname());
/*  236 */     if (null != hostWarnDiyDto) {
/*  237 */       if ("no".equals(hostWarnDiyDto.getDownSpeedMail())) {
/*  238 */         return false;
/*      */       }
/*  240 */       if (null != hostWarnDiyDto.getDownSpeedVal()) {
/*  241 */         downSpeedVal = hostWarnDiyDto.getDownSpeedVal();
/*      */       }
/*      */     } 
/*      */     
/*  245 */     if (!StringUtils.isEmpty(netIoState.getRxbyt()) && Double.valueOf(netIoState.getRxbyt()).doubleValue() >= downSpeedVal.doubleValue()) {
/*      */       try {
/*  247 */         String remark = HostUtil.addRemark(netIoState.getHostname());
/*  248 */         String title = "下行带宽告警：" + netIoState.getHostname() + remark;
/*  249 */         String commContent = "主机：" + netIoState.getHostname() + remark + "，当前下行带宽速率为" + Double.valueOf(netIoState.getRxbyt()) + "K/s，超过告警值" + downSpeedVal + "K/s";
/*      */         
/*  251 */         if (StaticKeys.mailSet != null) {
/*  252 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  255 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  257 */         WarnPools.MEM_WARN_MAP.put(key, "1");
/*      */         
/*  259 */         logInfoService.save(title, commContent, "1");
/*  260 */       } catch (Exception e) {
/*  261 */         logger.error("发送下行带宽告警邮件错误：", e);
/*  262 */         logInfoService.save("发送下行带宽告警邮件错误", e.toString(), "1");
/*      */       } 
/*      */     }
/*  265 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendDiskWarnInfo(DeskState deskState) {
/*  277 */     logger.debug("告警磁盘-------------" + deskState.getFileSystem());
/*  278 */     MailSet mailSet = StaticKeys.mailSet;
/*  279 */     String key = deskState.getHostname() + "_disk";
/*  280 */     boolean sign = preWarnInit(deskState.getHostname(), mailConfig.getDiskWarnMail(), key);
/*  281 */     if (!sign) {
/*  282 */       return false;
/*      */     }
/*  284 */     if (blockDisk(deskState)) {
/*  285 */       return false;
/*      */     }
/*  287 */     Double diskWarnVal = mailConfig.getDiskWarnVal();
/*      */     
/*  289 */     HostWarnDiyDto hostWarnDiyDto = (HostWarnDiyDto)StaticKeys.HOST_WARN_MAP.get(deskState.getHostname());
/*  290 */     if (null != hostWarnDiyDto) {
/*  291 */       if ("no".equals(hostWarnDiyDto.getDiskWarnMail())) {
/*  292 */         return false;
/*      */       }
/*  294 */       if (null != hostWarnDiyDto.getDiskWarnVal()) {
/*  295 */         diskWarnVal = hostWarnDiyDto.getDiskWarnVal();
/*      */       }
/*      */     } 
/*      */     
/*  299 */     Double usePer = Double.valueOf(deskState.getUsePer().replace("%", ""));
/*  300 */     if (usePer != null && usePer.doubleValue() >= diskWarnVal.doubleValue()) {
/*      */       try {
/*  302 */         String remark = HostUtil.addRemark(deskState.getHostname());
/*  303 */         String title = "磁盘告警：" + deskState.getHostname() + remark;
/*  304 */         String commContent = "主机：" + deskState.getHostname() + remark + "，磁盘" + deskState.getFileSystem() + "使用率为" + usePer + "，超过告警值" + diskWarnVal;
/*      */         
/*  306 */         if (StaticKeys.mailSet != null) {
/*  307 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  310 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  312 */         WarnPools.MEM_WARN_MAP.put(key, "1");
/*      */         
/*  314 */         logInfoService.save(title, commContent, "1");
/*  315 */       } catch (Exception e) {
/*  316 */         logger.error("发送磁盘告警邮件错误：", e);
/*  317 */         logInfoService.save("发送磁盘告警邮件错误", e.toString(), "1");
/*      */       } 
/*      */     }
/*      */     
/*  321 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   private static boolean blockDisk(DeskState deskState) {
/*  331 */     String diskBlock = mailConfig.getDiskBlock();
/*      */     
/*  333 */     HostWarnDiyDto hostWarnDiyDto = (HostWarnDiyDto)StaticKeys.HOST_WARN_MAP.get(deskState.getHostname());
/*  334 */     if (null != hostWarnDiyDto && 
/*  335 */       !StringUtils.isEmpty(hostWarnDiyDto.getDiskBlock())) {
/*  336 */       diskBlock = hostWarnDiyDto.getDiskBlock();
/*      */     }
/*      */ 
/*      */ 
/*      */     
/*  341 */     if (!StringUtils.isEmpty(diskBlock)) {
/*  342 */       String[] blocks = diskBlock.split(",");
/*  343 */       AntPathMatcher antPathMatcher = new AntPathMatcher();
/*  344 */       for (String diskBlcok : blocks) {
/*  345 */         diskBlcok = diskBlcok.replace("'", "");
/*  346 */         if ("/".equals(deskState.getFileSystem())) {
/*  347 */           if (diskBlcok.equals(deskState.getFileSystem())) {
/*  348 */             return true;
/*      */           }
/*      */         } else {
/*  351 */           boolean matchStart = antPathMatcher.matchStart(diskBlcok, deskState.getFileSystem());
/*  352 */           if (matchStart) {
/*  353 */             return matchStart;
/*      */           }
/*      */         } 
/*      */       } 
/*      */     } 
/*  358 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendCpuTemperatures(CpuTemperatures cpuTemperatures) {
/*  368 */     MailSet mailSet = StaticKeys.mailSet;
/*  369 */     String key = cpuTemperatures.getHostname() + "_temperatures";
/*  370 */     boolean sign = preWarnInit(cpuTemperatures.getHostname(), mailConfig.getCpuTemperatureWarnMail(), key);
/*  371 */     if (!sign) {
/*  372 */       return false;
/*      */     }
/*  374 */     Double cpuTemperatureWarnVal = mailConfig.getCpuTemperatureWarnVal();
/*      */     
/*  376 */     HostWarnDiyDto hostWarnDiyDto = (HostWarnDiyDto)StaticKeys.HOST_WARN_MAP.get(cpuTemperatures.getHostname());
/*  377 */     if (null != hostWarnDiyDto) {
/*  378 */       if ("no".equals(hostWarnDiyDto.getCpuTemperatureWarnMail())) {
/*  379 */         return false;
/*      */       }
/*  381 */       if (null != hostWarnDiyDto.getCpuTemperatureWarnVal()) {
/*  382 */         cpuTemperatureWarnVal = hostWarnDiyDto.getCpuTemperatureWarnVal();
/*      */       }
/*      */     } 
/*      */     
/*  386 */     Double inputVal = Double.valueOf(cpuTemperatures.getInput().replace("℃", "").replace("+", ""));
/*  387 */     if (inputVal != null && inputVal.doubleValue() >= cpuTemperatureWarnVal.doubleValue()) {
/*      */       try {
/*  389 */         String remark = HostUtil.addRemark(cpuTemperatures.getHostname());
/*  390 */         String title = "CPU温度告警：" + cpuTemperatures.getHostname() + remark;
/*  391 */         String commContent = "主机：" + cpuTemperatures.getHostname() + remark + "，CPU当前温度为" + cpuTemperatures.getInput() + "，超过告警值" + cpuTemperatureWarnVal + "℃";
/*      */         
/*  393 */         if (StaticKeys.mailSet != null) {
/*  394 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  397 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  399 */         WarnPools.MEM_WARN_MAP.put(key, "1");
/*      */         
/*  401 */         logInfoService.save(title, commContent, "1");
/*  402 */       } catch (Exception e) {
/*  403 */         logger.error("发送CPU温度告警邮件错误：", e);
/*  404 */         logInfoService.save("发送CPU温度告警邮件错误", e.toString(), "1");
/*      */       } 
/*      */     }
/*      */     
/*  408 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendHeathInfo(HeathMonitor heathMonitor, boolean isDown) {
/*  419 */     MailSet mailSet = StaticKeys.mailSet;
/*  420 */     if ("false".equals(mailConfig.getAllWarnMail()) || "false".equals(mailConfig.getHeathWarnMail())) {
/*  421 */       return false;
/*      */     }
/*  423 */     String key = heathMonitor.getId();
/*  424 */     if (isDown) {
/*  425 */       if (!StringUtils.isEmpty((CharSequence)WarnPools.MEM_WARN_MAP.get(key))) {
/*  426 */         return false;
/*      */       }
/*      */       try {
/*  429 */         String title = "服务接口检测告警：" + heathMonitor.getAppName();
/*  430 */         String commContent = "服务接口：" + heathMonitor.getAppName() + "，url：" + heathMonitor.getHeathUrl() + "，响应状态码为" + heathMonitor.getHeathStatus();
/*      */         
/*  432 */         if (StaticKeys.mailSet != null) {
/*  433 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  436 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  438 */         WarnPools.MEM_WARN_MAP.put(key, "1");
/*      */         
/*  440 */         logInfoService.save(title, commContent, "1");
/*  441 */       } catch (Exception e) {
/*  442 */         logger.error("发送服务健康检测告警邮件错误：", e);
/*  443 */         logInfoService.save("发送服务健康检测告警邮件错误", e.toString(), "1");
/*      */       } 
/*      */     } else {
/*  446 */       WarnPools.MEM_WARN_MAP.remove(key);
/*      */       try {
/*  448 */         String title = "服务接口已恢复：" + heathMonitor.getAppName();
/*  449 */         String commContent = "服务接口已恢复：" + heathMonitor.getAppName() + "，url：" + heathMonitor.getHeathUrl() + "，响应状态码为" + heathMonitor.getHeathStatus() + "";
/*      */         
/*  451 */         if (StaticKeys.mailSet != null) {
/*  452 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  455 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  457 */         logInfoService.save(title, commContent, "1");
/*  458 */       } catch (Exception e) {
/*  459 */         logger.error("发送服务接口已恢复邮件错误：", e);
/*  460 */         logInfoService.save("发送服务接口已恢复邮件错误", e.toString(), "1");
/*      */       } 
/*      */     } 
/*  463 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendDceInfo(DceInfo dceInfo, boolean isDown) {
/*  474 */     MailSet mailSet = StaticKeys.mailSet;
/*  475 */     if ("false".equals(mailConfig.getAllWarnMail()) || "false".equals(mailConfig.getDceWarnMail())) {
/*  476 */       return false;
/*      */     }
/*  478 */     String key = dceInfo.getId();
/*  479 */     String remark = dceInfo.getRemark();
/*  480 */     if (StringUtils.isEmpty(remark)) {
/*  481 */       remark = "";
/*      */     } else {
/*  483 */       remark = "(" + dceInfo.getRemark() + ")";
/*      */     } 
/*  485 */     if (isDown) {
/*  486 */       if (!StringUtils.isEmpty((CharSequence)WarnPools.MEM_WARN_MAP.get(key))) {
/*  487 */         return false;
/*      */       }
/*      */       try {
/*  490 */         String title = "数通设备PING超时告警：" + dceInfo.getHostname() + remark;
/*  491 */         String commContent = "数通设备：" + dceInfo.getHostname() + "，备注：" + remark + "，PING超时或失败";
/*      */         
/*  493 */         if (StaticKeys.mailSet != null) {
/*  494 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  497 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  499 */         WarnPools.MEM_WARN_MAP.put(key, "1");
/*      */         
/*  501 */         logInfoService.save(title, commContent, "1");
/*  502 */       } catch (Exception e) {
/*  503 */         logger.error("发送数通设备PING告警邮件错误：", e);
/*  504 */         logInfoService.save("发送数通设备PING告警邮件错误", e.toString(), "1");
/*      */       } 
/*      */     } else {
/*  507 */       WarnPools.MEM_WARN_MAP.remove(key);
/*      */       try {
/*  509 */         String title = "数通设备PING已恢复：" + dceInfo.getHostname() + remark;
/*  510 */         String commContent = "数通设备PING已恢复：" + dceInfo.getHostname() + "，备注：" + remark + "，ping值已恢复正常";
/*      */         
/*  512 */         if (StaticKeys.mailSet != null) {
/*  513 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  516 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  518 */         logInfoService.save(title, commContent, "1");
/*  519 */       } catch (Exception e) {
/*  520 */         logger.error("发送数通设备PING已恢复邮件错误：", e);
/*  521 */         logInfoService.save("发送数通设备PING已恢复邮件错误", e.toString(), "1");
/*      */       } 
/*      */     } 
/*  524 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendHostDown(SystemInfo systemInfo, boolean isDown) {
/*  535 */     MailSet mailSet = StaticKeys.mailSet;
/*  536 */     if (!StringUtils.isEmpty(mailConfig.getBlockIps()) && mailConfig.getBlockIps().contains(systemInfo.getHostname())) {
/*  537 */       return false;
/*      */     }
/*  539 */     if ("false".equals(mailConfig.getAllWarnMail()) || "false".equals(mailConfig.getHostDownWarnMail())) {
/*  540 */       return false;
/*      */     }
/*  542 */     String key = systemInfo.getId();
/*  543 */     String remark = (String)StaticKeys.HOST_MAP.get(systemInfo.getHostname());
/*  544 */     if (!StringUtils.isEmpty(remark)) {
/*  545 */       remark = "(" + remark + ")";
/*      */     } else {
/*  547 */       remark = "";
/*      */     } 
/*  549 */     if (isDown) {
/*  550 */       if (!StringUtils.isEmpty((CharSequence)WarnPools.MEM_WARN_MAP.get(key))) {
/*  551 */         return false;
/*      */       }
/*      */       try {
/*  554 */         String title = "主机下线告警：" + systemInfo.getHostname() + remark;
/*  555 */         String commContent = "主机已超过5分钟未上报数据，可能已下线：" + systemInfo.getHostname() + remark;
/*      */         
/*  557 */         if (StaticKeys.mailSet != null) {
/*  558 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  561 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  563 */         WarnPools.MEM_WARN_MAP.put(key, "1");
/*      */         
/*  565 */         logInfoService.save(title, commContent, "1");
/*  566 */       } catch (Exception e) {
/*  567 */         logger.error("发送主机下线告警邮件失败：", e);
/*  568 */         logInfoService.save("发送主机下线告警邮件错误", e.toString(), "1");
/*      */       } 
/*      */     } else {
/*  571 */       WarnPools.MEM_WARN_MAP.remove(key);
/*      */       try {
/*  573 */         String title = "主机已恢复上线：" + systemInfo.getHostname() + remark;
/*  574 */         String commContent = "主机已恢复上线：" + systemInfo.getHostname() + remark;
/*      */         
/*  576 */         if (StaticKeys.mailSet != null) {
/*  577 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  580 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  582 */         logInfoService.save(title, commContent, "1");
/*  583 */       } catch (Exception e) {
/*  584 */         logger.error("发送主机恢复上线通知邮件错误：", e);
/*  585 */         logInfoService.save("发送主机恢复上线通知邮件错误", e.toString(), "1");
/*      */       } 
/*      */     } 
/*  588 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendAppDown(AppInfo appInfo, boolean isDown) {
/*  599 */     MailSet mailSet = StaticKeys.mailSet;
/*  600 */     if (!StringUtils.isEmpty(mailConfig.getBlockIps()) && mailConfig.getBlockIps().contains(appInfo.getHostname())) {
/*  601 */       return false;
/*      */     }
/*  603 */     if ("false".equals(mailConfig.getAllWarnMail()) || "false".equals(mailConfig.getAppDownWarnMail())) {
/*  604 */       return false;
/*      */     }
/*  606 */     String key = appInfo.getId();
/*  607 */     String remark = (String)StaticKeys.HOST_MAP.get(appInfo.getHostname());
/*  608 */     if (!StringUtils.isEmpty(remark)) {
/*  609 */       remark = "(" + remark + ")";
/*      */     } else {
/*  611 */       remark = "";
/*      */     } 
/*  613 */     if (isDown) {
/*  614 */       if (!StringUtils.isEmpty((CharSequence)WarnPools.MEM_WARN_MAP.get(key))) {
/*  615 */         return false;
/*      */       }
/*      */       try {
/*  618 */         String title = "进程下线告警：" + appInfo.getHostname() + remark + "，进程：" + appInfo.getAppName();
/*  619 */         String commContent = "进程已超过5分钟未上报数据，可能已下线：" + appInfo.getHostname() + remark + "，进程：" + appInfo.getAppName();
/*      */         
/*  621 */         if (StaticKeys.mailSet != null) {
/*  622 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  625 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  627 */         WarnPools.MEM_WARN_MAP.put(key, "1");
/*      */         
/*  629 */         logInfoService.save(title, commContent, "1");
/*  630 */       } catch (Exception e) {
/*  631 */         logger.error("发送进程下线告警邮件失败：", e);
/*  632 */         logInfoService.save("发送进程下线告警错误", e.toString(), "1");
/*      */       } 
/*      */     } else {
/*  635 */       WarnPools.MEM_WARN_MAP.remove(key);
/*      */       try {
/*  637 */         String title = "进程已恢复上线：" + appInfo.getHostname() + remark + "，进程：" + appInfo.getAppName();
/*  638 */         String commContent = "进程已恢复上线：" + appInfo.getHostname() + remark + "，进程：" + appInfo.getAppName();
/*      */         
/*  640 */         if (StaticKeys.mailSet != null) {
/*  641 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  644 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  646 */         logInfoService.save(title, commContent, "1");
/*  647 */       } catch (Exception e) {
/*  648 */         logger.error("发送进程恢复上线通知邮件失败：", e);
/*  649 */         logInfoService.save("发送进程恢复上线通知错误", e.toString(), "1");
/*      */       } 
/*      */     } 
/*  652 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendDockerDown(DockerInfo dockerInfo, boolean isDown) {
/*  663 */     MailSet mailSet = StaticKeys.mailSet;
/*  664 */     if (!StringUtils.isEmpty(mailConfig.getBlockIps()) && mailConfig.getBlockIps().contains(dockerInfo.getHostname())) {
/*  665 */       return false;
/*      */     }
/*  667 */     if ("false".equals(mailConfig.getAllWarnMail()) || "false".equals(mailConfig.getDockerDownWarnMail())) {
/*  668 */       return false;
/*      */     }
/*  670 */     String key = dockerInfo.getId();
/*  671 */     String remark = (String)StaticKeys.HOST_MAP.get(dockerInfo.getHostname());
/*  672 */     if (!StringUtils.isEmpty(remark)) {
/*  673 */       remark = "(" + remark + ")";
/*      */     } else {
/*  675 */       remark = "";
/*      */     } 
/*  677 */     if (isDown) {
/*  678 */       if (!StringUtils.isEmpty((CharSequence)WarnPools.MEM_WARN_MAP.get(key))) {
/*  679 */         return false;
/*      */       }
/*      */       try {
/*  682 */         String title = "docker下线告警：" + dockerInfo.getHostname() + remark + "，名称：" + dockerInfo.getDockerName();
/*  683 */         String commContent = "docker已超过5分钟未上报数据，可能已下线：" + dockerInfo.getHostname() + remark + "，名称：" + dockerInfo.getDockerName() + "，dockerID：" + dockerInfo.getDockerId();
/*      */         
/*  685 */         if (StaticKeys.mailSet != null) {
/*  686 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  689 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  691 */         WarnPools.MEM_WARN_MAP.put(key, "1");
/*      */         
/*  693 */         logInfoService.save(title, commContent, "1");
/*  694 */       } catch (Exception e) {
/*  695 */         logger.error("发送docker下线告警邮件失败：", e);
/*  696 */         logInfoService.save("发送docker下线告警错误", e.toString(), "1");
/*      */       } 
/*      */     } else {
/*  699 */       WarnPools.MEM_WARN_MAP.remove(key);
/*      */       try {
/*  701 */         String title = "docker已恢复上线：" + dockerInfo.getHostname() + remark + "，名称：" + dockerInfo.getDockerName();
/*  702 */         String commContent = "docker已恢复上线：" + dockerInfo.getHostname() + remark + "，名称：" + dockerInfo.getDockerName() + "，dockerID：" + dockerInfo.getDockerId();
/*      */         
/*  704 */         if (StaticKeys.mailSet != null) {
/*  705 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  708 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  710 */         logInfoService.save(title, commContent, "1");
/*  711 */       } catch (Exception e) {
/*  712 */         logger.error("发送docker已恢复上线邮件失败：", e);
/*  713 */         logInfoService.save("发送docker已恢复上线错误", e.toString(), "1");
/*      */       } 
/*      */     } 
/*  716 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendPortDown(PortInfo portInfo, boolean isDown) {
/*  728 */     MailSet mailSet = StaticKeys.mailSet;
/*  729 */     if (!StringUtils.isEmpty(mailConfig.getBlockIps()) && mailConfig.getBlockIps().contains(portInfo.getHostname())) {
/*  730 */       return false;
/*      */     }
/*  732 */     if ("false".equals(mailConfig.getAllWarnMail()) || "false".equals(mailConfig.getPortWarnMail())) {
/*  733 */       return false;
/*      */     }
/*  735 */     String key = portInfo.getId();
/*  736 */     String remark = (String)StaticKeys.HOST_MAP.get(portInfo.getHostname());
/*  737 */     if (!StringUtils.isEmpty(remark)) {
/*  738 */       remark = "(" + remark + ")";
/*      */     } else {
/*  740 */       remark = "";
/*      */     } 
/*  742 */     if (isDown) {
/*  743 */       if (!StringUtils.isEmpty((CharSequence)WarnPools.MEM_WARN_MAP.get(key))) {
/*  744 */         return false;
/*      */       }
/*      */       try {
/*  747 */         String title = "端口telnet不通告警：" + portInfo.getHostname() + remark + "，端口：" + portInfo.getPort();
/*  748 */         String commContent = "端口telnet不通，可能已下线：" + portInfo.getHostname() + remark + "，名称：" + portInfo.getPortName() + "，端口：" + portInfo.getPort();
/*      */         
/*  750 */         if (StaticKeys.mailSet != null) {
/*  751 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  754 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  756 */         WarnPools.MEM_WARN_MAP.put(key, "1");
/*      */         
/*  758 */         logInfoService.save(title, commContent, "1");
/*  759 */       } catch (Exception e) {
/*  760 */         logger.error("发送端口telnet不通告警邮件错误：", e);
/*  761 */         logInfoService.save("发送端口telnet不通告警邮件错误", e.toString(), "1");
/*      */       } 
/*      */     } else {
/*  764 */       WarnPools.MEM_WARN_MAP.remove(key);
/*      */       try {
/*  766 */         String title = "端口已恢复上线：" + portInfo.getHostname() + remark + "，端口：" + portInfo.getPort();
/*  767 */         String commContent = "端口已恢复上线：" + portInfo.getHostname() + remark + "，名称：" + portInfo.getPortName() + "，端口：" + portInfo.getPort();
/*      */         
/*  769 */         if (StaticKeys.mailSet != null) {
/*  770 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  773 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  775 */         logInfoService.save(title, commContent, "1");
/*  776 */       } catch (Exception e) {
/*  777 */         logger.error("发送端口telnet已恢复告警邮件错误：", e);
/*  778 */         logInfoService.save("发送端口telnet已恢复告警邮件错误", e.toString(), "1");
/*      */       } 
/*      */     } 
/*  781 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendFileSafeDown(FileSafe fileSafe, boolean isDown) {
/*  792 */     MailSet mailSet = StaticKeys.mailSet;
/*  793 */     if (!StringUtils.isEmpty(mailConfig.getBlockIps()) && mailConfig.getBlockIps().contains(fileSafe.getHostname())) {
/*  794 */       return false;
/*      */     }
/*  796 */     if ("false".equals(mailConfig.getAllWarnMail()) || "false".equals(mailConfig.getPortWarnMail())) {
/*  797 */       return false;
/*      */     }
/*  799 */     String key = fileSafe.getId();
/*  800 */     String remark = (String)StaticKeys.HOST_MAP.get(fileSafe.getHostname());
/*  801 */     if (!StringUtils.isEmpty(remark)) {
/*  802 */       remark = "(" + remark + ")";
/*      */     } else {
/*  804 */       remark = "";
/*      */     } 
/*  806 */     if (isDown) {
/*  807 */       if (!StringUtils.isEmpty((CharSequence)WarnPools.MEM_WARN_MAP.get(key))) {
/*  808 */         return false;
/*      */       }
/*      */       try {
/*  811 */         String title = "文件防篡改监测告警：" + fileSafe.getHostname() + remark + "，文件：" + fileSafe.getFileName();
/*  812 */         String commContent = "文件防篡改监测告警，可能已下线：" + fileSafe.getHostname() + remark + "，文件：" + fileSafe.getFileName() + "，文件路径：" + fileSafe.getFilePath();
/*      */         
/*  814 */         if (StaticKeys.mailSet != null) {
/*  815 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  818 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  820 */         WarnPools.MEM_WARN_MAP.put(key, "1");
/*      */         
/*  822 */         logInfoService.save(title, commContent, "1");
/*  823 */       } catch (Exception e) {
/*  824 */         logger.error("文件防篡改监测告警邮件错误：", e);
/*  825 */         logInfoService.save("文件防篡改监测告警邮件错误", e.toString(), "1");
/*      */       } 
/*      */     } else {
/*  828 */       WarnPools.MEM_WARN_MAP.remove(key);
/*      */       try {
/*  830 */         String title = "文件防篡改监测已恢复：" + fileSafe.getHostname() + remark + "，文件：" + fileSafe.getFileName();
/*  831 */         String commContent = "文件防篡改监测已恢复上线：" + fileSafe.getHostname() + remark + "，文件：" + fileSafe.getFileName() + "，文件路径：" + fileSafe.getFilePath();
/*      */         
/*  833 */         if (StaticKeys.mailSet != null) {
/*  834 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  837 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  839 */         logInfoService.save(title, commContent, "1");
/*  840 */       } catch (Exception e) {
/*  841 */         logger.error("文件防篡改监测已恢复告警邮件错误：", e);
/*  842 */         logInfoService.save("文件防篡改监测已恢复警邮件错误", e.toString(), "1");
/*      */       } 
/*      */     } 
/*  845 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendDbDown(DbInfo dbInfo, boolean isDown) {
/*  857 */     MailSet mailSet = StaticKeys.mailSet;
/*  858 */     if ("false".equals(mailConfig.getAllWarnMail()) || "false".equals(mailConfig.getDbDownWarnMail())) {
/*  859 */       return false;
/*      */     }
/*  861 */     String key = dbInfo.getId();
/*  862 */     if (isDown) {
/*  863 */       if (!StringUtils.isEmpty((CharSequence)WarnPools.MEM_WARN_MAP.get(key))) {
/*  864 */         return false;
/*      */       }
/*      */       try {
/*  867 */         String title = "数据源连接失败告警：" + dbInfo.getAliasName();
/*  868 */         String commContent = "数据源连接失败：" + dbInfo.getAliasName();
/*      */         
/*  870 */         if (StaticKeys.mailSet != null) {
/*  871 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  874 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  876 */         WarnPools.MEM_WARN_MAP.put(key, "1");
/*      */         
/*  878 */         logInfoService.save(title, commContent, "1");
/*  879 */       } catch (Exception e) {
/*  880 */         logger.error("发送数据源连接失败邮件错误：", e);
/*  881 */         logInfoService.save("发送数据源连接失败告警错误", e.toString(), "1");
/*      */       } 
/*      */     } else {
/*  884 */       WarnPools.MEM_WARN_MAP.remove(key);
/*      */       try {
/*  886 */         String title = "数据源已恢复上线：" + dbInfo.getAliasName();
/*  887 */         String commContent = "数据源已恢复上线：" + dbInfo.getAliasName();
/*      */         
/*  889 */         if (StaticKeys.mailSet != null) {
/*  890 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  893 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */         
/*  895 */         logInfoService.save(title, commContent, "1");
/*  896 */       } catch (Exception e) {
/*  897 */         logger.error("发送数据源已恢复上线邮件错误：", e);
/*  898 */         logInfoService.save("发送数据源已恢复上线错误", e.toString(), "1");
/*      */       } 
/*      */     } 
/*  901 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendFileWarnDown(FileWarnInfo fileWarnInfo, String warnContent, boolean isDown) {
/*  912 */     MailSet mailSet = StaticKeys.mailSet;
/*  913 */     if (!StringUtils.isEmpty(mailConfig.getBlockIps()) && mailConfig.getBlockIps().contains(fileWarnInfo.getHostname())) {
/*  914 */       return false;
/*      */     }
/*  916 */     if ("false".equals(mailConfig.getAllWarnMail()) || "false".equals(mailConfig.getFileLogWarnMail())) {
/*  917 */       return false;
/*      */     }
/*  919 */     String key = fileWarnInfo.getId();
/*  920 */     String remark = (String)StaticKeys.HOST_MAP.get(fileWarnInfo.getHostname());
/*  921 */     if (!StringUtils.isEmpty(remark)) {
/*  922 */       remark = "(" + remark + ")";
/*      */     } else {
/*  924 */       remark = "";
/*      */     } 
/*  926 */     if (isDown) {
/*  927 */       if (!StringUtils.isEmpty((CharSequence)WarnPools.MEM_WARN_MAP.get(key))) {
/*  928 */         return false;
/*      */       }
/*      */       try {
/*  931 */         String title = "日志监控告警：" + fileWarnInfo.getHostname() + remark;
/*  932 */         String commContent = "日志监控告警：" + fileWarnInfo.getHostname() + remark + "，日志文件：" + fileWarnInfo.getFilePath() + "，" + warnContent;
/*      */         
/*  934 */         if (StaticKeys.mailSet != null) {
/*  935 */           sendMail(mailSet.getToMail(), title, commContent);
/*      */         }
/*      */         
/*  938 */         ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */ 
/*      */ 
/*      */         
/*  942 */         logInfoService.save(title, commContent, "1");
/*  943 */       } catch (Exception e) {
/*  944 */         logger.error("发送日志监控告警邮件错误", e);
/*  945 */         logInfoService.save("发送日志监控告警错误", e.toString(), "1");
/*      */       } 
/*      */     } 
/*  948 */     return false;
/*      */   }
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */   
/*      */   public static boolean sendShellInfo(ShellInfo shellInfo) {
/*  958 */     MailSet mailSet = StaticKeys.mailSet;
/*  959 */     if ("false".equals(mailConfig.getAllWarnMail())) {
/*  960 */       return false;
/*      */     }
/*      */     try {
/*  963 */       String title = "开始下发指令信息：" + shellInfo.getShellName();
/*  964 */       String commContent = "下发指令信息：" + shellInfo.getShellName() + "，指令内容：" + shellInfo.getShell();
/*      */       
/*  966 */       if (StaticKeys.mailSet != null) {
/*  967 */         sendMail(mailSet.getToMail(), title, commContent);
/*      */       }
/*      */       
/*  970 */       ExecUtil.runScript(mailConfig.getWarnScript(), commContent);
/*      */       
/*  972 */       logInfoService.save(title, commContent, "1");
/*  973 */     } catch (Exception e) {
/*  974 */       logger.error("下发指令信息邮件错误：", e);
/*  975 */       logInfoService.save("下发指令信息错误", e.toString(), "1");
/*      */     } 
/*  977 */     return false;
/*      */   }
/*      */   
/*      */   public static String sendMail(String mails, String mailTitle, String mailContent) {
/*      */     try {
/*  982 */       HtmlEmail email = new HtmlEmail();
/*  983 */       email.setHostName(StaticKeys.mailSet.getSmtpHost());
/*  984 */       email.setSmtpPort(Integer.valueOf(StaticKeys.mailSet.getSmtpPort()).intValue());
/*  985 */       if ("1".equals(StaticKeys.mailSet.getSmtpSSL())) {
/*  986 */         email.setSSL(true);
/*      */       }
/*  988 */       email.setAuthenticator((Authenticator)new DefaultAuthenticator(StaticKeys.mailSet.getFromMailName(), StaticKeys.mailSet.getFromPwd()));
/*  989 */       email.setFrom(StaticKeys.mailSet.getFromMailName());
/*  990 */       email.setSubject("[CloudTi] " + mailTitle);
/*  991 */       email.setCharset("UTF-8");
/*  992 */       email.setHtmlMsg(mailContent + "<p><p><p><p>" + DateUtil.getCurrentDateTime() + "<p><p><p><a target='_blank' href='#'>CloudTi</a>敬上");
/*  993 */       email.addTo(mails.split(";"));
/*  994 */       email.setSentDate(new Date());
/*  995 */       email.send();
/*  996 */       return "success";
/*  997 */     } catch (Exception e) {
/*  998 */       logger.error("发送邮件错误", e);
/*  999 */       logInfoService.save("发送邮件错误", e.toString(), "1");
/* 1000 */       return "error";
/*      */     } 
/*      */   }
/*      */ }


/* Location:              /Users/zhangyongxin/soft-install/wgcloud/wgcloud-v3.3.5/server/bank/wgcloud-server-release.jar!/BOOT-INF/classes/com/wgcloud/util/msg/WarnMailUtil.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */